﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:FirstFloor.ModernUI.Windows.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/Converters.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="controls:ModernTab">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ModernTab">
                    <Grid>
                        <!-- link list -->
                        <ListBox x:Name="LinkList" ItemsSource="{TemplateBinding Links}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="{DynamicResource HeaderMargin}"
                                 ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                                 ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                 ScrollViewer.CanContentScroll="False"
                                 ScrollViewer.PanningMode="Both">
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                                    <Setter Property="FontFamily" Value="Segoe UI" />
                                    <Setter Property="Foreground" Value="{DynamicResource MenuText}" />
                                    <Setter Property="FontSize" Value="15"/>
                                    <Setter Property="FontWeight" Value="Bold" />
                                    <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
                                    <Setter Property="Foreground" Value="{DynamicResource MenuText}" />
                                    <Setter Property="Margin" Value="12,0,0,0" />
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                                <ContentPresenter x:Name="Presenter"
                                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                <ControlTemplate.Triggers>
                                                    <Trigger Property="IsMouseOver" Value="true">
                                                        <Setter Property="Foreground" Value="{DynamicResource MenuTextHover}"/>
                                                    </Trigger>
                                                    <Trigger Property="IsSelected" Value="true">
                                                        <Setter Property="Foreground" Value="{DynamicResource MenuTextSelected}"/>
                                                    </Trigger>
                                                </ControlTemplate.Triggers>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>

                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal" />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>

                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding DisplayName, Converter={StaticResource ToUpperConverter}}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>

                        <!-- content -->
                        <controls:ModernFrame Source="{Binding SelectedSource, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" ContentLoader="{TemplateBinding ContentLoader}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="Layout" Value="List">
                <Trigger.Setters>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="controls:ModernTab">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="{TemplateBinding ListWidth}"/>
                                        <ColumnDefinition Width="9" />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>

                                    <!-- link list -->
                                    <ListBox x:Name="LinkList" ItemsSource="{TemplateBinding Links}"
                                             ScrollViewer.HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" >
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding DisplayName, Converter={StaticResource ToUpperConverter}}" Margin="10,2,2,2" FontSize="{DynamicResource SmallFontSize}" TextTrimming="CharacterEllipsis" />
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>

                                    <!-- seperator -->
                                    <Rectangle Grid.Column="1" Fill="{DynamicResource SeparatorBackground}" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" />

                                    <!-- content -->
                                    <controls:ModernFrame Grid.Column="2" Source="{Binding SelectedSource, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" ContentLoader="{TemplateBinding ContentLoader}" Margin="32,0,0,0" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger.Setters>
            </Trigger>
        </Style.Triggers>

    </Style>

</ResourceDictionary>